Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for build-depends on hover #4385

Merged
merged 19 commits into from
Sep 8, 2024

Conversation

VenInf
Copy link
Contributor

@VenInf VenInf commented Aug 19, 2024

Documentation for build-depends on hover.

If you hover over the field under build-depends
it will give Documentation with a hackage link to a package.

Video with an example:

cabal-hover-cut.mp4

Implementation details

This is a naive solution for this problem, hovered text is filtered using
a regex and compared to found dependencies from PackageDescription.
If it was found, then the Documentation message is added, otherwise left as is.

This approach assumes, that if a package is mentioned in a cabal file, there should be
a link with the same name. In this implementation there are no spelling checks.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks, otherwise good to go!

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just needs to be rebased or merge changes from upstream!

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@VeryMilkyJoe VeryMilkyJoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@fendor fendor merged commit 96c3aa7 into haskell:master Sep 8, 2024
33 of 34 checks passed
soulomoon pushed a commit to soulomoon/haskell-language-server that referenced this pull request Sep 23, 2024
If you hover over the field under `build-depends`
it will give Documentation with a hackage link to a package.

Video with an example:


* + hover

* + hover handler

* working prototype

* bugfix

* rm TODO

* + tests

* docs

* requested changes

* - Debug.Trace

* schema

* Apply suggestions from code review

Co-authored-by: fendor <[email protected]>

* resolve merge issues

* runActionE -> runAction

* revert prev, useWithStaleE -> useE

* Update plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs

Co-authored-by: fendor <[email protected]>

* + documentation

---------

Co-authored-by: fendor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants